
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>标准库 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="测试.html" />
    
    
    <link rel="prev" href="模块.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="基础.html">
            
                <a href="基础.html">
            
                    
                    基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="字符串处理.html">
            
                <a href="字符串处理.html">
            
                    
                    字符串处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="数据结构.html">
            
                <a href="数据结构.html">
            
                    
                    数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="数据结构高级内容.html">
            
                <a href="数据结构高级内容.html">
            
                    
                    数据结构高级内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="函数.html">
            
                <a href="函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="函数式编程.html">
            
                <a href="函数式编程.html">
            
                    
                    函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="面向对象编程.html">
            
                <a href="面向对象编程.html">
            
                    
                    面向对象编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="类的特殊方法.html">
            
                <a href="类的特殊方法.html">
            
                    
                    类的特殊方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="异常处理.html">
            
                <a href="异常处理.html">
            
                    
                    异常处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="IO编程.html">
            
                <a href="IO编程.html">
            
                    
                    IO编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="模块.html">
            
                <a href="模块.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.13" data-path="标准库.html">
            
                <a href="标准库.html">
            
                    
                    标准库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="测试.html">
            
                <a href="测试.html">
            
                    
                    测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="调试.html">
            
                <a href="调试.html">
            
                    
                    调试
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >标准库</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6807;&#x51C6;&#x5E93;">&#x6807;&#x51C6;&#x5E93;</h1>
<hr>
<h2 id="sys">sys</h2>
<p>sys.argv&#xFF1A;&#x811A;&#x672C;&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF0C;sys.argv[0]&#x662F;&#x811A;&#x672C;&#x540D;&#xFF0C;sys.argv[1]&#x662F;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;...<br>sys.path&#xFF1A;&#x5305;&#x542B;&#x8F93;&#x5165;&#x6A21;&#x5757;&#x7684;&#x76EE;&#x5F55;&#x540D;&#x5217;&#x8868;&#x3002;<br>sys.version_info[0]&#xFF1A;&#x67E5;&#x770B;Python&#x7684;&#x4E3B;&#x7248;&#x672C;&#x53F7;&#x3002;  </p>
<h2 id="os">os</h2>
<p>os.name&#xFF1A;&#x67E5;&#x770B;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7C7B;&#x578B;&#x3002;&#x5982;&#x679C;&#x8F93;&#x51FA;&#x662F; <code>&apos;posix&apos;</code>&#xFF0C;&#x5219;&#x662F; Linux&#x3001;Unix &#x6216; Mac OS X&#xFF1B;&#x5982;&#x679C;&#x662F; <code>&apos;nt&apos;</code>&#xFF0C;&#x5219;&#x662F; Windows&#x3002;<br>os.getcwd()&#x51FD;&#x6570;&#xFF1A;&#x67E5;&#x8BE2;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x3002;<br>os.system(&apos;shell_cmd&apos;)&#x51FD;&#x6570;&#xFF1A;&#x8FD0;&#x884C;&#x547D;&#x4EE4;&#x3002;  </p>
<h2 id="&#x679A;&#x4E3E;&#x7C7B;">&#x679A;&#x4E3E;&#x7C7B;</h2>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
Month = Enum(<span class="hljs-string">&apos;Month&apos;</span>, (<span class="hljs-string">&apos;Jan&apos;</span>, <span class="hljs-string">&apos;Feb&apos;</span>, <span class="hljs-string">&apos;Mar&apos;</span>, <span class="hljs-string">&apos;Apr&apos;</span>, <span class="hljs-string">&apos;May&apos;</span>, <span class="hljs-string">&apos;Jun&apos;</span>, \
<span class="hljs-string">&apos;Jul&apos;</span>,<span class="hljs-string">&apos;Aug&apos;</span>, <span class="hljs-string">&apos;Sep&apos;</span>, <span class="hljs-string">&apos;Oct&apos;</span>, <span class="hljs-string">&apos;Nov&apos;</span>, <span class="hljs-string">&apos;Dec&apos;</span>))
</code></pre>
<p>&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x83B7;&#x5F97;&#x4E86; Month &#x7C7B;&#x578B;&#x7684;&#x679A;&#x4E3E;&#x7C7B;&#xFF0C;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528; <code>Month.Jan</code> &#x6765;&#x5F15;&#x7528;&#x4E00;&#x4E2A;&#x5E38;&#x91CF;&#xFF0C;&#x6216;&#x8005;&#x679A;&#x4E3E;&#x5B83;&#x7684;&#x6240;&#x6709;&#x6210;&#x5458;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> name, member <span class="hljs-keyword">in</span> Month.__members__.items():
    print(name, <span class="hljs-string">&apos;=&gt;&apos;</span>, member, <span class="hljs-string">&apos;,&apos;</span>, member.value)
<span class="hljs-comment"># value &#x5C5E;&#x6027;&#x5219;&#x662F;&#x81EA;&#x52A8;&#x8D4B;&#x7ED9;&#x6210;&#x5458;&#x7684; int &#x5E38;&#x91CF;&#xFF0C;&#x9ED8;&#x8BA4;&#x4ECE; 1 &#x5F00;&#x59CB;&#x8BA1;&#x6570;&#x3002;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="模块.html" class="navigation navigation-prev " aria-label="Previous page: 模块">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="测试.html" class="navigation navigation-next " aria-label="Next page: 测试">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"标准库","level":"1.13","depth":1,"next":{"title":"测试","level":"1.14","depth":1,"path":"测试.md","ref":"测试.md","articles":[]},"previous":{"title":"模块","level":"1.12","depth":1,"path":"模块.md","ref":"模块.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"标准库.md","mtime":"2017-08-27T03:39:32.281Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-08-27T04:11:18.522Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

